Announcement

Collapse
No announcement yet.

Óñëîâèå â ôîðìóëå ïîêóïêè

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Óñëîâèå â ôîðìóëå ïîêóïêè

    Ïðèâåò,
    ß óæå íåñêîëüêî äíåé ïûòàþñü äîáèòüñÿ îòâåòà íà ýòîò âîïðîñ â EFS Studies. Îòâåòà íåò. Ìîæåò âû ïîìîæåòå?
    Ó ìåíÿ åñòü ôîðìóëà ïîêóïêè.
    function preMain() {
    setPriceStudy(true);
    setStudyTitle("Buy 4 GSV");
    setCursorLabelName("Buy 4 GSV");

    setDefaultBarStyle(PS_SOLID);
    setDefaultBarFgColor(Color.blue);
    setDefaultBarThickness(2);
    setPlotType(PLOTTYPE_FLATLINES);
    }

    function main() {

    return open(0) + (((high(-4) - open(-4) + high(-3) - open(-3) + high(-2) - open(-2) + high(-1) - open(-1)) / 4 ) * 1.8);

    }
    Ìíå íóæíî âñòàâèòü òóäà ñëåäóþùåå óñëîâèå: high-open îñóùåñòâëÿåòñÿ òîëüêî â òå äíè êîòîðûå çàêðûëèñü íèæå îòêðûòèÿ. íàïðèìåð ôîðìóëà èäåò íà 1 äåíü íàçàä (high(-1)-open(-1), íî åñëè â ýòîò äåíü close>open òî ôîðìóëà èãíîðèðóåò ýòîò äåíü è èäåò åùå íà 1 äåíü íàçàä. Åñëè ýòîò äåíü ñîîòâåòñòâóåò óñëîâèå close<open òî îí ñ÷èòàåòñÿ
    äíåì -1 è ò.ä. Âîçìîæíî ëè ýòî ñäåëàòü?
    Ñ óâàæåíèåì Tonal
    Tonal

  • #2
    À â ÷åì êîíêðåòíî çàêëþ÷àåòñÿ ïðîáëåìà? Èñïîëüçóéòå îáû÷íîå óñëîâèå:

    for(i = -3; i <= 0; i++)
    if(close(i) < open(i))
    sum += high(i) - open(i);

    Comment


    • #3
      Ñåé÷àñ ôîðìóëà ñ÷èòàåò ïîäðÿä 4 áàðà íàçàä, ò.å. íå èãíîðèðóåò äíè ñ çàêðûòèåì ââåðõ(Close>open).
      Òàêèì îáðàçîì îíà äîëæíà ñ÷èòàòü äíè íàçàä, â êîòîðûõ close<open 4 ðàçà.Çàòåì ïîëó÷åííîå ÷èñëî äåëèòü íà 4,óìíîæàòü íà 1.8 è ïðèáàâëÿòü ê Open òåêóùåãî äíÿ,ïîêàçûâàÿ ýòî íà ãðàôèêå â âèäå ëèíèè.Ýòî ìåñòî äëÿ ïîêóïêè.
      Tonal.
      Tonal

      Comment


      • #4
        Âñåì ñïàñèáî, ÿ ðàçîáðàëñÿ.
        Êîìó èíòåðåñíî, îáðàùàéòåñü.
        Ñ óâàæåíèåì Tonal
        Tonal

        Comment

        Working...
        X